home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / dvcron10.arc / CRON.DOC < prev    next >
Text File  |  1991-12-21  |  6KB  |  143 lines

  1. Cron 1.1
  2. (c) 1991 -- Kyle A. York
  3. ------------------------
  4.  
  5.   Here's my attempt to port the Unix Cron utility to MS-DOS. Feel free
  6.   to do with program as you please --but-- always leave my name in the
  7.   source and documentation and ALWAYS note any changes you have made. I
  8.   don't want bad code running around with my name on it.
  9.  
  10. Acknowledgements
  11.  
  12.   Ralph Brown for his invaluable interrupt list and DVGLUE library.
  13.  
  14. Command Format
  15.  
  16.   CRON [-c filename] [-d filename] [-l filename] [-l-] [-m memsize]
  17.  
  18.   -d filename : set the template .dvp file to filename
  19.   -c filename : set the CRONTAB file to filename (default is crontab
  20.                 in the same directory as cron.exe)
  21.   -l filename : set logfile to filename (default is cron.log in the
  22.                 same directory as cron.exe)
  23.   -l-         : disable the log file
  24.   -m memsize  : set the CRONTAB buffer to memsize. default is 1K.
  25.  
  26.   This is meant to be run in it's own window. The "cr-pif.dvp" file
  27.   provided should work for most people (after changing the program path &
  28.   such).
  29.  
  30. CRONTAB format
  31.  
  32.   the first 5 fields are: minute (0-59), hour (0-23), day of month (1-
  33.   31), month of year (1-12) and day of week (0-6, 0=sunday). A '*' is
  34.   used for "any allowable value". The fields are seperated by spaces.
  35.  
  36.   ex: 0 0 1,15 * 3 [switches] {command} [paramaters]
  37.  
  38.   will execute the command at 00:00 on the 1st and 15th of every month
  39.   and on every Wednesday. The number list can be comma-seperated
  40.   (1,15) or ranges (1-5,6-9). VERY LITTLE error checking is done. If a
  41.   number is out of range, it will never be found so {command} will
  42.   never be executed. If a * appears anywhere in the field, the fields
  43.   will ALWAYS match (eg 1,2,4-7,*,9 is equivalent to *). A range is
  44.   assumed to be low to high. If it is entered high to low, only the
  45.   limits will match (eg 7-4 will match 7 and 4, but not 5 and 6
  46.   whereas 4-7 will match 4,5,6,7).
  47.  
  48.   {command} format
  49.  
  50.     This is where I had to deviate somewhat from the UNIX format. The
  51.     command can be optionally preceded by some switches as follows:
  52.  
  53.       -b        : force this window to start in the background
  54.       -c n      : if n < 0, set minimum conventional memory to -n K
  55.                 : if n > 0, set maximum conventional memory to n K
  56.                 : this might seem kind of clunky but its the best I could
  57.                 : think to do.
  58.       -e n      : set maximum expanded memory to n K
  59.       -h        : force this window to start hidden
  60.  
  61.     If the command has the extension '.exe', '.com', or '.dvp' it must
  62.     also have the full path to reach the file. In other words the DOS
  63.     path is not traversed to find the program. Any other extension
  64.     (most notably ".bat") will load the current command shell
  65.     (normally COMMAND.COM) and pass the command as a parameter.
  66.  
  67.     If the command has an extension '.exe' or '.com' the window is set
  68.     to close on completion. If it has a '.dvp' then the command is run
  69.     verbatim from the info in the '.dvp'. If it has any other
  70.     extension, the command interpreter is loaded and the command is
  71.     sent to the interpreter. Generally if you are running a batch file
  72.     and you want the window to close on completion, the last command
  73.     in the batch file should be 'exit'.
  74.  
  75.   parameters format
  76.  
  77.     The parameters string is parsed for the following strings:
  78.       %M, %D, %h, %m
  79.     If these are found, %M is replaces with the 2-digit month, %D with
  80.     the 2-digit day of month, %h with the 2-digit hour, and %m with
  81.     the 2-digit minute. An example of this is included in the example
  82.     CRONTAB file. I needed a way to backup my disks using a unique
  83.     name, and the month + day strings worked quite well.
  84.  
  85.     After this parsing, the parameters are sent to the program.
  86.  
  87. Limitations
  88.  
  89.   DesqView allows only 63 characters for the full path to the program,
  90.   and 63 characters for the parameters. If the parameters string is
  91.   greater than 63 characters it is truncated with a warning written to
  92.   the log file. If a '.bat' file is run, the path to the program is
  93.   cleared and the parameters are set to the program name + parameters
  94.   therefore the full string (program name + parameters) must be less
  95.   than 63 characters. If not it is truncated with a warning written to
  96.   the log file.
  97.  
  98.   Also, opening a new application is done using DVapp_start(). From
  99.   the DVGLUE documentation:
  100.     "This function is known to cause lockups under DV 2.00 (6-16-87).
  101.      Use at your own risk (though I would appreciate hearing from you
  102.      which version (and date) you are using and whether or not it
  103.      worked). [Ralph Brown]"
  104.   I have used this with DV 2.4 without problems, your mileage may
  105.   vary.
  106.  
  107. Comments
  108.  
  109.   The CRONTAB file is opened when CRON begins and is left open while
  110.   CRON is running. Therefore it is HIGHLY RECOMMENDED that you also
  111.   load SHARE.EXE so one doesn't accidently deleted the file as this
  112.   would have highly unpredictable results. I use the timer functions
  113.   of DV so the amount of time spent in CRON is minimal. With a 3 line
  114.   CRONTAB file which executes commands once per day, and some once per
  115.   hour, my machine uses only about 1 minute / day for the CRON
  116.   process. Each minute, the first thing done is a check on CRONTAB to
  117.   see whether it's been modified. If it has, it is re-read. You will
  118.   note that there is no year entry in the CRONTAB file. This means
  119.   that a CRONTAB entry will never expire. If you set it to a certain
  120.   date (say 12 December) then it will execute only once per year.
  121.  
  122.   I have been using this program for about one week and have tried
  123.   every parameter but I cannot guarentee this will not crash. If it
  124.   does, or you have any other problems, please mail me at
  125.  
  126.     Internet:
  127.       noesis@ucscb.ucsc.edu
  128.       kyley@cats.ucsc.edu
  129.     CompuServe:
  130.       72125,1533
  131.  
  132.  
  133. Technical Stuff
  134.  
  135.   This program was compiled with Turbo C 2.0 using the small memory
  136.   model and optimization set to 'size'. I've heard it said "never set
  137.   optimization to size" and always believed it until now. I felt there
  138.   was little speed gain to be had.
  139.  
  140.   I tried my best to keep this thing small, and am very happy with the
  141.   19K result. If you see somewhere that the code can be optimized
  142.   please let me know.
  143.